package com.gree.flowable.app.tools.pattern;

import com.gree.flowable.app.pojo.vo.NextElementVO;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.SequenceFlow;

import java.util.ArrayList;
import java.util.List;

public class AllAllotStrategy implements AllotNodeVoStrategy<List<SequenceFlow>> {
    @Override
    public List<NextElementVO> pack(List<SequenceFlow> data) {
        List<NextElementVO> list = new ArrayList<>();
        data.forEach(out->{
            FlowElement targetEl = out.getTargetFlowElement();
            NextElementVO vo = new NextElementVO();
            vo.setName(targetEl.getName());
            vo.setElementId(targetEl.getId());
            vo.setDocumentation(targetEl.getDocumentation());
            vo.setFlowName(out.getName()==null?"":out.getName());
            list.add(vo);
        });
        return list;
    }
}
